package cz.gelion.shylock.invoice.web.comp

import org.apache.wicket.ajax.markup.html.AjaxLink
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes
import org.apache.wicket.ajax.attributes.AjaxCallListener

abstract class AjaxDefferedLink(id:String,message:() => String) extends AjaxLink[Void](id){
   override def updateAjaxAttributes(attr:AjaxRequestAttributes) = {
	  super.updateAjaxAttributes(attr)
	  val a = new AjaxCallListener
	  a.onPrecondition("return confirm('" + message() + "');")
	  attr.getAjaxCallListeners().add(a)
   }
  
}